<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const arr = [
        { name: '张三', score: 99, sex: '男' },
        { name: '李四', score: 100, sex: '男' },
        { name: '王武', score: 77, sex: '女' },
        { name: '张红', score: 68, sex: '男' },
      ]
      // 定义最大分数容器
      let max = 0
      // 遍历数组找出最高分数
      for(let i = 0;i<arr.length;i++) {
        // console.log(arr[i].score); 
        max = max > arr[i].score ? max : arr[i].score
      }
      // console.log(max);
      // 将最高分数和所有分数进行对比，分数等于max的打印
      for(let i = 0;i<arr.length;i++) {
        // console.log(arr[i].score); 
        if(max === arr[i].score){
          console.log(arr[i]);
        }
      }
    </script>
  </body>
</html>
